//
//  ZCMeAuditDetailsVC.m
//  zctx
//
//  Created by apple on 15/10/14.
//  Copyright © 2015年 sanliang. All rights reserved.
//

#import "ZCMeAuditDetailsVC.h"
#import "ZCSamplingProgressCell.h"
@interface ZCMeAuditDetailsVC ()

@end

@implementation ZCMeAuditDetailsVC

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [MobClick beginLogPageView:@"ZCMeAuditDetailsVC"];
}
- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    [MobClick endLogPageView:@"ZCMeAuditDetailsVC"];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"抽检项目详情";
    
}


-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 4;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
        if (section==0) {
            return 1;
        }else if(section==1){
            return 2;
        }else if(section==2){
            return 5;
        }else{
            return 1;
        }
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    //    ZCProjectdetailsModel *detailsmodel = [ZCProjectdetailsModel modelObjectWithDictionary:datadictionary];
    ZCDeatailsHeaderCell *cell = [tableView dequeueReusableCellWithIdentifier:@"headercell"];
    if (indexPath.section==0) {
        cell = [[ZCDeatailsHeaderCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"headercell" cellType:ZCDeatailsHeaderCellTypestate];
        cell.labelTitle.text =@"检测状态:";
        cell.stateImgView.image = [UIImage imageNamed:@"details_sampling"];
        return cell;
    }
    else if (indexPath.section==1) {
        if (indexPath.row==0) {
            cell = [[ZCDeatailsHeaderCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"headercell" cellType:ZCDeatailsHeaderCellTypedetails];
            cell.labelTitle.text = @"检测内容:";
            cell.detailsView.titleLable.text = @"危害简介";
            cell.detailsView.titleColor = [UIColor redColor];
        }else{
            cell = [[ZCDeatailsHeaderCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"headercell" cellType:ZCDeatailsHeaderCellTypecontent];
        }
        return cell;
    }else if (indexPath.section==2){
        
        cell = [[ZCDeatailsHeaderCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"headercell" cellType:ZCDeatailsHeaderCellTypeinfo];
        return cell;
    }else{
        ZCDeatailsHeaderCell *cell = [[ZCDeatailsHeaderCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"headercell" cellType:ZCDeatailsHeaderCellTypeinfo];
        cell.labelTitle.text = @"目标金额:";
        cell.labelInfo.textColor = [UIColor redColor];
        return cell;
    }
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section==0) {
        return 60;
    }else if (indexPath.section==1) {
        return 44;
    }else if (indexPath.section==2){
        return 44;
    }else if(indexPath.section==3){
        return 44;
    }else{
        return 60;
    }
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    if (section<3) {
        return 10;
    }else{
        return 40;
    }
}

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    if (section<3) {
        UIView * headView = [[UIView alloc]init];
        return headView;
    }else{
        NSArray *titleArray = [NSArray arrayWithObjects:@"众筹信息",nil];
        UIView * headView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 40)];
        
        UIView *newView = [UIView new];
        [headView addSubview:newView];
        newView.backgroundColor = [UIColor whiteColor];
        [newView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(headView.top).with.offset(10);
            make.left.equalTo(headView).with.offset(0);
            make.right.equalTo(headView).with.offset(0);
            make.bottom.equalTo(headView).with.offset(0);
        }];
        
        UILabel *leftlable = [UILabel new];
        [newView addSubview:leftlable];
        leftlable.font = [UIFont systemFontOfSize:16];
        [leftlable setText:titleArray[section-3]];
        [leftlable mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(newView.mas_centerY);
            make.left.equalTo(newView).with.offset(15);
            make.height.mas_equalTo(@30);
            make.width.mas_equalTo(@150);
        }];
        return headView;
    }
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}


@end
